import jakarta.servlet.*;
import jakarta.servlet.annotation.WebFilter;

import java.io.IOException;

@WebFilter("/a")
public class MyFilter implements Filter {


    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        System.out.println("测试");
    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("测试1");
        filterChain.doFilter(servletRequest,servletResponse);  //放行
        System.out.println("放行后1");
    }

    @Override
    public void destroy() {
        Filter.super.destroy();
    }
}
